using System.Collections;
using System.Collections.Generic;
using System.Text;
using CC_Util;
using UnityEngine;

public class test02_cppTcp : MonoBehaviour {    
    void Start() {
        S_Connect();
    }          
    void S_Connect() {
        commonDLL.C_ClientSocket.S_Connect("192.168.1.235", 18899, S_state, S_recv);
    }   
    void S_state(int ii) {
        Debug.LogErrorFormat("链接状态改变............." + ii);
        if (ii != 0) {
            C_Delay.S_wait(2).d_delayEndEvent = delegate () {
                S_Connect();
            };
        } else {

        }
    }
    void S_recv(byte[] bytes) {
        Debug.LogErrorFormat("收到消息............"+ Encoding.UTF8.GetString(bytes));
    }
    private void Update() {
        if (Time.time - lastTime < 1) { return; }
        lastTime = Time.time;
        commonDLL.C_ClientSocket.S_Send("牛逼无敌消息sssssssss_" + lastTime);
    }
    float lastTime;

}
